//
//  MoreViewController.m
//  ZhiHuiLiJiang
//
//  Created by Work on 2018/11/20.
//  Copyright © 2018年 WisdomLijiang. All rights reserved.
//已废弃

#import "MoreViewController.h"
#import "NavigationView.h"
#import "FollowViewOneTypeCell.h"
#import "ContentCell.h"
#import "BYcitizenModel.h"
@interface MoreViewController ()<NavigationViewDelegate,UITableViewDelegate,UITableViewDataSource>

@property (nonatomic ,strong) NavigationView * nagationView;

@property (nonatomic ,strong) UITableView * MainTableView;
@property(nonatomic,strong)NSArray *topicListDataArr;


@end

@implementation MoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self hideNavigationBar:YES animated:YES];
    [self.view addSubview:self.nagationView];
    [self.view addSubview:self.MainTableView];
    
    
    NSDictionary *dict3 = @{@"page":@"2",@"limit":@"10"};
    [self gettopicList:dict3];//热议列表

}
-(void)gettopicList:(NSDictionary *)dict{
    BY_kWeakSelf(ws);
    NSString *str;
    if ([self.type isEqualToString:@"热门景点"]) {
        str = LJURL_Visitor_spot_list;
    }
    if ([self.type isEqualToString:@"玩法路线"]) {
        str = LJURL_Visitor_travelguide_list;
    }
    else{
        str = LJURL_Visitor_info_list;
    }

    [BYNetworking requestGetOrPostWithType:GET url:str params:dict success:^(NSInteger code, NSString * _Nonnull msg, id  _Nonnull data) {
        NSDictionary *dict = [data objectForKey:@"paginator"];
        NSArray *dataArr = dict[@"records"];
        NSMutableArray *dataArrM = [NSMutableArray arrayWithCapacity:dataArr.count];
        for (NSDictionary *dic in dataArr) {
            BYcitizenModel *topCarouselModel = [BYcitizenModel mj_objectWithKeyValues:dic];
            [dataArrM addObject:topCarouselModel];
            
        }
        ws.topicListDataArr = dataArrM.copy;
        [ws.MainTableView reloadData];
        
    } fail:^(NSError * _Nonnull error) {
        
    } showHUD:YES];
    
    
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    if (!self.tabBarController.tabBar.isHidden) {
        self.tabBarController.tabBar.hidden = YES;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NavigationView *)nagationView{
    if (!_nagationView) {
        _nagationView = [[NavigationView alloc]initWithFrame:CGRectMake(0, 0, KSCREEWIDTH, 64) withLeftImageUrl:[NSArray arrayWithObjects:@"mainIcon_back",@"mainIcon_back",nil] withRighitImageUrl:nil withRightStr:nil withColor:nil];
        _nagationView.titleLabel.text = self.type;
        _nagationView.backgroundColor = [UIColor whiteColor];
        _nagationView.delegate = self;
        _nagationView.titleLabel.textColor = [UIColor blackColor];
        _nagationView.rightBtn.hidden = YES;
    }
    return _nagationView;
}

- (UITableView *)MainTableView
{
    if (!_MainTableView) {
        _MainTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, KSCREEWIDTH, KSCREEHEGIHT  -64) style:UITableViewStylePlain];
        _MainTableView.delegate = self;
        _MainTableView.dataSource = self;
        _MainTableView.backgroundColor = [UIColor whiteColor];
        _MainTableView.tableFooterView = [UIView new];
        [_MainTableView registerClass:[FollowViewOneTypeCell class] forCellReuseIdentifier:@"FollowViewOneTypeCell"];
        [_MainTableView registerClass:[ContentCell class] forCellReuseIdentifier:@"ContentCell"];

        
        
    }
    return _MainTableView;
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([self.type isEqualToString:@"热门景点"]) {
        FollowViewOneTypeCell  *cell = [tableView dequeueReusableCellWithIdentifier:@"FollowViewOneTypeCell" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.heardImageView.image = [UIImage imageNamed:@"hotDiscussion_1"];
        cell.tagLabel.hidden = YES;
        cell.titleLabel.text = @"丽江古城";
        cell.redTagLabel.text = @"5A";
        cell.redTagrightLabel.text = @"世界文化遗产 | 必游Top4";
        cell.contentLabel.text = @"景点景点景点景点景点景点景点世界文化遗产 | 必游Top4世界文化遗产 | 必游Top4世界文化遗产 | 必游Top4世界文化遗产 | 必游Top4世界文化遗产 | 必游Top4";
        return cell;

    }
    if ([self.type isEqualToString:@"玩法路线"]) {
        FollowViewOneTypeCell  *cell = [tableView dequeueReusableCellWithIdentifier:@"FollowViewOneTypeCell" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.heardImageView.image = [UIImage imageNamed:@"hotDiscussion_1"];
        cell.tagLabel.hidden = YES;
        cell.titleLabel.text = @"丽江古城";
        cell.redTagLabel.text = @"30%";
        cell.redTagrightLabel.text = @"世界文化遗产 | 必游Top4";
        cell.contentLabel.text = @"路线:>丽江古城>猴子上>丽江";

        return cell;
        
    }

    else{
        ContentCell  *cell = [tableView dequeueReusableCellWithIdentifier:@"ContentCell" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.HimageView.image = [UIImage imageNamed:@"hotDiscussion_1"];
        cell.timeLabel.text =@"11:11";
        cell.contentLabel.text =@"sasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasa";
        cell.numLabel.text =@"11";
        cell.conteryLabel.text =@"扬州日报";
        cell.titleLabel.text =@"市政府慰问";

        return cell;

    }
}


#pragma mark - UITableViewDelegate -

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([self.type isEqualToString:@"内容精选"]) {
        return 110;
    }
    return 100;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
}
-(void)navigtionleftBackclick:(UIButton *)sender{
    [self.navigationController popViewControllerAnimated:YES];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
